import { Button } from "antd";
import { usePersistore } from "@/store/middle/persit";

// 中间件
const MiddleDemo2: React.FC = () => {
  const { count, testObj, increment, updateName } = usePersistore();
  const clear = () => {
    usePersistore.persist.clearStorage();
  };
  return (
    <div>
      <h1>中间件Persist 缓存自动 </h1>
      <p> count: {count} </p>
      <p> count: {JSON.stringify(testObj)} </p>
      <Button onClick={increment}> cout++ </Button>
      <Button onClick={() => updateName("newName")}> updateName </Button>
      <Button onClick={clear}> 清空 </Button>
    </div>
  );
};

export default MiddleDemo2;
